package cn.iocoder.yudao.module.wrdk.dal.mysql.licence;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wrdk.dal.dataobject.licence.wrdklicenceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wrdk.controller.admin.licence.vo.*;

/**
 * 地块许可证 Mapper
 *
 * @author Fan Kaixiang
 */
@Mapper
public interface wrdklicenceMapper extends BaseMapperX<wrdklicenceDO> {

    default PageResult<wrdklicenceDO> selectPage(wrdklicencePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<wrdklicenceDO>()
                .eqIfPresent(wrdklicenceDO::getLandid, reqVO.getLandid())
                .eqIfPresent(wrdklicenceDO::getUserid, reqVO.getUserid())
                .eqIfPresent(wrdklicenceDO::getLicenceArea, reqVO.getLicenceArea())
                .eqIfPresent(wrdklicenceDO::getAvailableArea, reqVO.getAvailableArea())
                .betweenIfPresent(wrdklicenceDO::getLicenceDate, reqVO.getLicenceDate())
                .eqIfPresent(wrdklicenceDO::getDataLock, reqVO.getDataLock())
                .eqIfPresent(wrdklicenceDO::getLicenceStatus, reqVO.getLicenceStatus())
                .eqIfPresent(wrdklicenceDO::getLicenceCode, reqVO.getLicenceCode())
                .eqIfPresent(wrdklicenceDO::getLandUseCode, reqVO.getLandUseCode())
                .likeIfPresent(wrdklicenceDO::getLandUseName, reqVO.getLandUseName())
                .eqIfPresent(wrdklicenceDO::getCuryear, reqVO.getCuryear())
                .eqIfPresent(wrdklicenceDO::getNote, reqVO.getNote())
                .eqIfPresent(wrdklicenceDO::getJzdzb, reqVO.getJzdzb())
                .eqIfPresent(wrdklicenceDO::getSaveflag, reqVO.getSaveflag())
                .eqIfPresent(wrdklicenceDO::getState, reqVO.getState())
                .orderByDesc(wrdklicenceDO::getId));
    }

    default List<wrdklicenceDO> selectList(wrdklicenceExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<wrdklicenceDO>()
                .eqIfPresent(wrdklicenceDO::getLandid, reqVO.getLandid())
                .eqIfPresent(wrdklicenceDO::getUserid, reqVO.getUserid())
                .eqIfPresent(wrdklicenceDO::getLicenceArea, reqVO.getLicenceArea())
                .eqIfPresent(wrdklicenceDO::getAvailableArea, reqVO.getAvailableArea())
                .betweenIfPresent(wrdklicenceDO::getLicenceDate, reqVO.getLicenceDate())
                .eqIfPresent(wrdklicenceDO::getDataLock, reqVO.getDataLock())
                .eqIfPresent(wrdklicenceDO::getLicenceStatus, reqVO.getLicenceStatus())
                .eqIfPresent(wrdklicenceDO::getLicenceCode, reqVO.getLicenceCode())
                .eqIfPresent(wrdklicenceDO::getLandUseCode, reqVO.getLandUseCode())
                .likeIfPresent(wrdklicenceDO::getLandUseName, reqVO.getLandUseName())
                .eqIfPresent(wrdklicenceDO::getCuryear, reqVO.getCuryear())
                .eqIfPresent(wrdklicenceDO::getNote, reqVO.getNote())
                .eqIfPresent(wrdklicenceDO::getJzdzb, reqVO.getJzdzb())
                .eqIfPresent(wrdklicenceDO::getSaveflag, reqVO.getSaveflag())
                .eqIfPresent(wrdklicenceDO::getState, reqVO.getState())
                .orderByDesc(wrdklicenceDO::getId));
    }

}
